<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jstl_forEach.jsp</title>
</head>
<body>
	<h1>forEach</h1>
	<h4>1~10까지 출력</h4>
	<c:forEach var="index" begin="1" end="10">
		${index }
	</c:forEach>
	<h4>2~20까지 수 중 짝수만 출력</h4>
	<c:forEach var="index" begin="2" end="20" step="2">
		${index }
	</c:forEach>
	<h4>배열 사용</h4>
	<%
		String[] hello = {"h", "e", "l", "l", "o"};
		request.setAttribute("hello", hello);
	%>
	<h4>전체 출력</h4>
	<c:forEach var="item" items="${hello }">
		<c:out value="${item }"/>
	</c:forEach>
	
	<h4>forEach의 상태값</h4>
	<c:forEach var="item" items="${hello }" begin="1" end="5" step="2" varStatus="status">
		current: <c:out value="${status.current }"/>
		index: <c:out value="${status.index }"/>
		count: <c:out value="${status.count }"/>
		<br/>
	</c:forEach>
</body>
</html>